package com.mall.shopping.converter;

import com.mall.shopping.dal.entitys.Item;
import com.mall.shopping.dto.ProductDetailDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

/**
 * @author liyongqiang
 * CreateDate 2021/7/21 15:08
 */

@Mapper(componentModel = "spring")
public interface ProductDetailConverter {

    @Mappings({
            @Mapping(source = "id", target = "productId"),
            @Mapping(source = "price", target = "salePrice"),
            @Mapping(source = "title", target = "productName"),
            @Mapping(source = "sellPoint", target = "subTitle"),
            @Mapping(source = "limitNum", target = "limitNum"),
            @Mapping(source = "imageBig", target = "productImageBig")
//            @Mapping(source = "item.getImages", target = "productImageSmall")

    })
    ProductDetailDto productDetailDo2Dto(Item item);
}
